<#-- 默认系统通知列表 -->
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
		  content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>系统通知列表 - ${title}</title>
	<meta name="keywords" content="${keywords}"/>
	<meta name="description" content="${description}"/>
	<base href="${baseURL}" target="_self">


	<#-- 获取令牌 -->
	<meta name="csrfToken" content="${token}"/>
	<link href="${commonPath}css/common.css" type="text/css" rel="stylesheet" charset="utf-8">
	<link href="${commonPath}css/themify-icons/style.css" type="text/css" rel="stylesheet">
	<script src="${commonPath}js/tool.js" type="text/javascript"></script>
	<script src="${commonPath}js/ajax.js" type="text/javascript"></script>
	<script src="${commonPath}js/jquery/jquery.min.js" type="text/javascript"></script>
	<link href="${commonPath}js/layer/skin/default/layer.css"  type="text/css" rel="stylesheet"/>
	<script type="text/javascript" src="${commonPath}js/layer/layer.js"></script>
</head>
<body>
<#-- 引入页头 -->
<@include action="${newPublic_2}"/>
<div class="skeleton ">
	<div class="main backgroundModule" >
		<#-- 引入服务导航 -->
		<@include action="${newPublic_4}"/>

		<div class="systemNotifyTitle"><h2>全部系统通知</h2></div>

		<#if pageView.records??>
			<div class="systemNotifyModule" >
				<ol class="systemNotifyList">
					<#list pageView.records as subscriptionSystemNotify>
						<div class="systemNotify">
							<div class="author">
								<div class="tipBottom">
									<span class="a-toolbar">
										<#if subscriptionSystemNotify.status == 10><span>未读</span></#if>
										<#if subscriptionSystemNotify.status == 20><span style="color: #009A29;">已读</span></#if>
										<a href="javascript:" onclick="deleteSystemNotify('${subscriptionSystemNotify.id}')"><i class="cms-trash" ></i>删除</a>

									</span>
								</div>
							</div>
							<div class="time">${subscriptionSystemNotify.sendTime}</div>
							<p class="content" ><#noescape>${subscriptionSystemNotify.content}</#noescape></p>
							<div class="clearfix"></div>
						</div>
					</#list>
				</ol>
				<div class="systemNotifyPage">
					<@include action="${newPublic_1}"/>
				</div>
			</div>

		</#if>


	</div>

</div>

<script type="text/javascript">
	//删除系统通知
	function deleteSystemNotify(id){
		var parameter = "";//URI参数
		parameter += "&subscriptionSystemNotifyId="+id;
		//从meta标签获取令牌
		parameter += "&token="+getCsrf();

		if(parameter.indexOf("&") == 0){
			parameter = parameter.substring(1,parameter.length);
		}
		post_request(function(value){
			if(value != ""){
				var returnValue = JSON.parse(value);//JSON转为对象
				for(var key in returnValue){
					if(key == "success"){
						var success = returnValue[key];
						if(success == "true"){
							layer.msg('删除系统通知成功,1秒后刷新页面',
									{
										time: 1000 //1秒关闭（如果不配置，默认是1秒）
									},function(){
										//关闭后的操作
										document.location.reload();//刷新页面
									}
							);
						}
					}else if(key == "error"){
						var errorValue = returnValue[key];
						var htmlValue = "";
						var i = 0;
						for(var error in errorValue){
							if(error != ""){
								i++;
								htmlValue += "&nbsp;&nbsp;"+i+"、"+errorValue[error]+"<br>";
							}
						}

						layer.open({
							type: 1,
							title: '错误',
							skin: 'layui-layer-rim', //加上边框
							area: ['300px', '150px'], //宽高
							content: htmlValue
						});

					}
				}
			}
		},
				getBasePath()+"user/control/deleteSystemNotify?timestamp=" + new Date().getTime(), true,parameter);
	}
</script>

<#--引入页脚-->
<@include action="${newPublic_3}"/>
</body>
</html>
